3.665 \(\int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^n \, dx\)

Optimal. Leaf size=63 \[ \frac{a (B+i A) (c-i c \tan (e+f x))^n}{f n}-\frac{a B (c-i c \tan (e+f x))^{n+1}}{c f (n+1)} \]

[Out]

(a*(I*A + B)*(c - I*c*Tan[e + f*x])^n)/(f*n) - (a*B*(c - I*c*Tan[e + f*x])^(1 + n))/(c*f*(1 + n))

________________________________________________________________________________________

Rubi [A]  time = 0.0944794, antiderivative size = 63, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 39, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.051, Rules used = {3588, 43} \[ \frac{a (B+i A) (c-i c \tan (e+f x))^n}{f n}-\frac{a B (c-i c \tan (e+f x))^{n+1}}{c f (n+1)} \]

Antiderivative was successfully verified.

[In]

Int[(a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^n,x]

[Out]

(a*(I*A + B)*(c - I*c*Tan[e + f*x])^n)/(f*n) - (a*B*(c - I*c*Tan[e + f*x])^(1 + n))/(c*f*(1 + n))

Rule 3588

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[(a*c)/f, Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rule 43

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rubi steps

\begin{align*} \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^n \, dx &=\frac{(a c) \operatorname{Subst}\left (\int (A+B x) (c-i c x)^{-1+n} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{(a c) \operatorname{Subst}\left (\int \left ((A-i B) (c-i c x)^{-1+n}+\frac{i B (c-i c x)^n}{c}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{a (i A+B) (c-i c \tan (e+f x))^n}{f n}-\frac{a B (c-i c \tan (e+f x))^{1+n}}{c f (1+n)}\\ \end{align*}

Mathematica [A]  time = 3.82473, size = 75, normalized size = 1.19 \[ \frac{i a (c \sec (e+f x))^n (A n+A+B n \tan (e+f x)-i B) \exp (n (-\log (c \sec (e+f x))+\log (c-i c \tan (e+f x))))}{f n (n+1)} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^n,x]

[Out]

(I*a*E^(n*(-Log[c*Sec[e + f*x]] + Log[c - I*c*Tan[e + f*x]]))*(c*Sec[e + f*x])^n*(A - I*B + A*n + B*n*Tan[e +
f*x]))/(f*n*(1 + n))

________________________________________________________________________________________

Maple [B]  time = 0.347, size = 128, normalized size = 2. \begin{align*}{\frac{i{{\rm e}^{n\ln \left ( c-ic\tan \left ( fx+e \right ) \right ) }}Aa}{f \left ( 1+n \right ) }}+{\frac{i{{\rm e}^{n\ln \left ( c-ic\tan \left ( fx+e \right ) \right ) }}Aa}{fn \left ( 1+n \right ) }}+{\frac{{{\rm e}^{n\ln \left ( c-ic\tan \left ( fx+e \right ) \right ) }}aB}{fn \left ( 1+n \right ) }}+{\frac{iBa\tan \left ( fx+e \right ){{\rm e}^{n\ln \left ( c-ic\tan \left ( fx+e \right ) \right ) }}}{f \left ( 1+n \right ) }} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^n,x)

[Out]

I/f/(1+n)*exp(n*ln(c-I*c*tan(f*x+e)))*A*a+I/f/n/(1+n)*exp(n*ln(c-I*c*tan(f*x+e)))*A*a+1/f/n/(1+n)*exp(n*ln(c-I
*c*tan(f*x+e)))*a*B+I*a*B/f/(1+n)*tan(f*x+e)*exp(n*ln(c-I*c*tan(f*x+e)))

________________________________________________________________________________________

Maxima [B]  time = 2.09935, size = 420, normalized size = 6.67 \begin{align*} \frac{{\left ({\left (A - i \, B\right )} a c^{n} n +{\left (A - i \, B\right )} a c^{n}\right )} 2^{n} \cos \left (-2 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 2 \, e\right ) +{\left ({\left (A + i \, B\right )} a c^{n} n +{\left (A - i \, B\right )} a c^{n}\right )} 2^{n} \cos \left (n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) -{\left ({\left (i \, A + B\right )} a c^{n} n +{\left (i \, A + B\right )} a c^{n}\right )} 2^{n} \sin \left (-2 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 2 \, e\right ) -{\left ({\left (i \, A - B\right )} a c^{n} n +{\left (i \, A + B\right )} a c^{n}\right )} 2^{n} \sin \left (n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right )}{{\left (-i \, n^{2} +{\left (-i \, n^{2} - i \, n\right )} \cos \left (2 \, f x + 2 \, e\right ) +{\left (n^{2} + n\right )} \sin \left (2 \, f x + 2 \, e\right ) - i \, n\right )}{\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac{1}{2} \, n} f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^n,x, algorithm="maxima")

[Out]

(((A - I*B)*a*c^n*n + (A - I*B)*a*c^n)*2^n*cos(-2*f*x + n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1) - 2*
e) + ((A + I*B)*a*c^n*n + (A - I*B)*a*c^n)*2^n*cos(n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1)) - ((I*A
+ B)*a*c^n*n + (I*A + B)*a*c^n)*2^n*sin(-2*f*x + n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1) - 2*e) - ((
I*A - B)*a*c^n*n + (I*A + B)*a*c^n)*2^n*sin(n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1)))/((-I*n^2 + (-I
*n^2 - I*n)*cos(2*f*x + 2*e) + (n^2 + n)*sin(2*f*x + 2*e) - I*n)*(cos(2*f*x + 2*e)^2 + sin(2*f*x + 2*e)^2 + 2*
cos(2*f*x + 2*e) + 1)^(1/2*n)*f)

________________________________________________________________________________________

Fricas [A]  time = 1.40102, size = 225, normalized size = 3.57 \begin{align*} \frac{{\left ({\left (i \, A - B\right )} a n +{\left (i \, A + B\right )} a +{\left ({\left (i \, A + B\right )} a n +{\left (i \, A + B\right )} a\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \left (\frac{2 \, c}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right )^{n}}{f n^{2} + f n +{\left (f n^{2} + f n\right )} e^{\left (2 i \, f x + 2 i \, e\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^n,x, algorithm="fricas")

[Out]

((I*A - B)*a*n + (I*A + B)*a + ((I*A + B)*a*n + (I*A + B)*a)*e^(2*I*f*x + 2*I*e))*(2*c/(e^(2*I*f*x + 2*I*e) +
1))^n/(f*n^2 + f*n + (f*n^2 + f*n)*e^(2*I*f*x + 2*I*e))

________________________________________________________________________________________

Sympy [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: AttributeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))**n,x)

[Out]

Exception raised: AttributeError

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (B \tan \left (f x + e\right ) + A\right )}{\left (i \, a \tan \left (f x + e\right ) + a\right )}{\left (-i \, c \tan \left (f x + e\right ) + c\right )}^{n}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^n,x, algorithm="giac")

[Out]

integrate((B*tan(f*x + e) + A)*(I*a*tan(f*x + e) + a)*(-I*c*tan(f*x + e) + c)^n, x)